<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>数据字典详细信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/systemStatic/style/admin.css">
    <link rel="stylesheet" href="${ctx}/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/css/public.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body>

<script type="text/html" template>

    <div>
        <form class="layui-form" requrl="{{ serverPath.systemPath + layui.setter.sysLinkPath }}dictionary/get" lay-filter="dictionaryDataForm">
            <div style="margin: 15px 15px;height: 190px;overflow: auto;">
                <div class="layui-form-item">
                    <label class="layui-form-label">项名</label>
                    <div class="layui-input-block">
                        <input type="text" name="itemName" id="itemName" placeholder="请输入项名"
                               autocomplete="off" class="layui-input " lay-verify="required" maxlength="25" fieldname="itemname">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">字典关键字</label>
                    <div class="layui-input-block">
                        <input type="text" name="itemKey"  placeholder="请输入项Key"
                               autocomplete="off" class="layui-input " lay-verify="required" maxlength="25" fieldname="itemkey"/>
                        <div>字典关键字在该数据字典中必须唯一。</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">项值</label>
                    <div class="layui-input-block">
                        <input type="text" name="itemValue" id="itemValue"  placeholder="请输入项值"
                               autocomplete="off" class="layui-input " lay-verify="required" maxlength="25" fieldname="itemvalue">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">序列</label>
                    <div class="layui-input-block">
                        <input type="text" name="sn" id="sn"  placeholder="请输入序列"
                               autocomplete="off" class="layui-input " lay-verify="required|sort" maxlength="25" fieldname="sn">
                    </div>
                </div>
                <input type="hidden" name="parentId" />
                <input type="hidden" name="typeId" />
                <input type="hidden" name="nodePath" />
                <input type="hidden" name="dicId" />
                <input type="hidden" name="isRoot" />
            </div>

            <div class="layui-form-item" style="margin-bottom: 15px;">
                <div style="text-align: center;">
                    <a lay-submit lay-filter="dictionary" class="layui-btn btn-n btn-save" requrl="{{serverPath.systemPath + layui.setter.sysLinkPath}}dictionary/save">提交</a>
                    <button type="reset" id="closeWindow" class="layui-btn btn-n layui-btn-danger">取消</button>
                </div>
            </div>
        </form>
    </div>

</script>
<script src="${ctx}/public/component.js" type="text/javascript"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>

    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','common','jquery','form','commons'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        var commons = layui.commons;
        form.verify(commons.formVerify);

        $("#itemName").change(function () {
            var str = $(this).val();
            if (str == "") return;
            var arrRslt = component.chineseToPinyinAlias(str);
            $("#itemValue").val(arrRslt[0]);
        });

        var parentId = "${parentId}";
        $("input[name='parentId']").val(parentId);
        var typeId = "${typeId}";
        $("input[name='typeId']").val(typeId);
        var nodePath = "${nodePath}";
        $("input[name='nodePath']").val(nodePath);
        var dicId = "${dicId}";
        $("input[name='dicId']").val(dicId);
        var isRoot = "${isRoot}";
        $("input[name='isRoot']").val(isRoot);

        var index = parent.layer.getFrameIndex(window.name);
        //关闭当前页面
        $("#closeWindow").click(function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        })

        var common = layui.common;
        common.updateForm({
            name:'dictionaryDataForm',
            idValue:"${dicId}",
            primary:"dicId",
            updateCallback:function (data) {
                if (common.filterRecord(data)) {
                    layer.alert(data.msg, {skin: 'btn-class'},function () {
                        common.bulletWindow(index);
                    });
                } else {
                    window.parent.layer.alert(data.msg);
                }
                return false;
            }
        });
    });
</script>
</body>
</html>